package com.zyy.study.jdk8NewFeatures;

public class FunctionDemo {
    public static void main(String[] args) {
        TestFunction testFunction1 = new TestFunction() {
            @Override
            public void test() {
                System.out.println("实现方法1");
            }
        };
        TestFunction testFunction2=()->{
            System.out.println("实现方法2");
        };
        testFunction1.test();
        testFunction2.test();
        new TestFunction2Impl().print(()->{
            return 1;
        });

    }
}
@FunctionalInterface
interface TestFunction {
    void test();
}
interface TestFunction2{
    int test();
}
class TestFunction2Impl{
    public void print(TestFunction2 testFunction2) {
        System.out.println(testFunction2.test());
    }
}